import {
  createAction,
} from 'redux-actions'
import {
  manage,
} from 'api'
import {
  createAjaxAction,
} from 'utils'

// 获取用户管理左侧分类列表的action
export const requestUserSortList = createAction('request userSort list');
export const recevieUserSortList = createAction('receive userSort list');
export const fetchUserSortList = createAjaxAction(
  manage.userManages,
  requestUserSortList,
  recevieUserSortList
);

// 获取用户列表的action
export const requestUserList = createAction('request user list');
export const recevieUserList = createAction('receive user list');
export const fetchUserList = createAjaxAction(
  manage.userList,
  requestUserList,
  recevieUserList
);

// 用户列表更新以及重置的action
export const updateUserListQuery = createAction('update userList search query', payload => payload);
export const resetUserListQuery = createAction('reset userList search query');

//删除用户
export const requestDeleteUser = createAction('request user delete', payload => payload);
export const recevieDeleteUser = createAction('receive user delete', payload => payload);
export const fetchUserDelete = createAjaxAction(
  manage.userDelete,
  requestDeleteUser,
  recevieDeleteUser
);

// 获取用户详情的action
export const requestUserDetail = createAction('request user detail')
export const recevieUserDetail = createAction('receive user detail')
export const fetchUserDetail = createAjaxAction(manage.userDetail, requestUserDetail, recevieUserDetail)


// 获取用户角色的action
export const requestUserRole = createAction('request user rloe')
export const recevieUserRole = createAction('receive user rloe')
export const fetchHouseRole = createAjaxAction(manage.userRole, requestUserRole, recevieUserRole)

// 更新用户信息，包括详情和角色
export const updateUserInfoQuery = createAction('update userInfo query', payload => payload);
